package com.jerei.crm.controller;

import com.jerei.crm.entity.FollowCustomer;
import com.jerei.crm.service.IFollowCustomer;
import com.jerei.crm.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

@RestController
@RequestMapping("/follow")
public class FollowCustomerController extends BaseController{

    @Autowired
    IFollowCustomer followCustomer;


    @RequestMapping("/add")
    public JsonResult<Void> add(String content, Integer cid, HttpSession session){

        Integer uid=getUidFromSession(session);
        followCustomer.addFollow(content,cid,uid);

        return new JsonResult<>(OK);
    }

    @RequestMapping("/list")
    public JsonResult<List<FollowCustomer>> findByCid(Integer cid){

        List<FollowCustomer> list=followCustomer.findByCid(cid);
        return new JsonResult<>(OK,list);
    }




}
